<extend name="./public/frame.html"/>
<block name="content">
    <form class="layui-form" action="{$url}" method="post">
        <input name="driver_id" value="{$info['driver_id']}" hidden>
        <table class="layui-table">
            <col width="40%"/>
            <col width="60%"/>
            <volist name="fields" id="field">
                <tr>
                    <td>{$field}</td>
                    <eq name="key" value="driver_name">
                        <td>{$info[$key]}</td>
                        <else/>
                        <empty name="info[$key]">
                            <td>{$info['driver_name']}{$field}</td>
                            <else/>
                            <php>$thumb = $key.'_thumb';</php>
                            <td class="layer-photos-demo">
                                <img layer-src="{$info[$key]}" alt="{$info['driver_name']}{$field}" src="{$info[$thumb]}">
                            </td>
                        </empty>
                    </eq>
                </tr>
            </volist>
            <tr>
                <td>信息是否符合要求:</td>
                <td>
                    <input type="checkbox" data-id="{$info['id']}" value="3" lay-skin="switch" lay-text="是|否" lay-filter="is_use">
                    <input type="text" name="auth_avatar" id="auth_avatar" value="3" hidden>
                </td>
            </tr>
            <tr id="auth">
                <td>不符合原因:</td>
                <td><textarea name="not_auth_reason" placeholder="请输入原因" class="layui-textarea" lay-verify="required"></textarea></td>
            </tr>
            <tr>
                <td colspan="2">
                    <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </td>
            </tr>
        </table>
    </form>
    <script type="application/javascript">
        layui.use(['form','layer'], function(){
            var layer = layui.layer,
                form = layui.form;
            layer.photos({
                photos: '.layer-photos-demo'
                ,anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
                ,tab: function(pic, layero){
                    var str = "<div style='text-align: center'>"+pic.alt+"</div>";
                    layero.prepend(str);
                }
            });
            //监听启用/停用操作
            form.on('switch(is_use)', function(obj){
                var check = obj.elem;
                var value = obj.value;
                var auth = $('#auth');
                var auth_avatar = $('#auth_avatar');
                switch(value){
                    case '1':
                        auth.show().children('td').children('textarea').attr('lay-verify','required');
                        $(check).prop('checked',obj.elem.checked).val('3');
                        auth_avatar.val('3');
                        form.render('checkbox');
                        break;
                    case '3':
                        auth.hide().children('td').children('textarea').attr('lay-verify','');
                        $(check).prop('checked',obj.elem.checked).val('1');
                        auth_avatar.val('1');
                        form.render('checkbox');
                        break;
                    default:
                        break;
                }
            });
        });
    </script>
</block>